package butines.game.steering.behavior;

import butines.core.math2d.Vector2D;
import butines.game.steering.Vehicle;

public class SeekBehavior extends AbstractBehavior {

	private Vehicle seeker;
	private Vector2D target = new Vector2D();
	private Vector2D steeringForce = new Vector2D();

	public Vehicle getSeeker() {
		return seeker;
	}

	public void setSeeker(Vehicle seeker) {
		this.seeker = seeker;
	}

	public Vector2D getTarget() {
		return target;
	}

	public void setTarget(Vector2D target) {
		this.target.set(target);
	}

	@Override
	public Vector2D calculate() {
		if (seeker == null) {
			return steeringForce.set(0, 0);
		}
		seek(steeringForce, seeker, target);
		return steeringForce.mult(getWeight());
	}

	public Vector2D getSteeringForce() {
		return steeringForce;
	}

}
